<?php

/**
 * CEP_Brazil form base class.
 *
 * @package    form
 * @subpackage cep_brazil
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseCEP_BrazilForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'bai_no'              => new sfWidgetFormInput(),
      'cep'                 => new sfWidgetFormInput(),
      'log_tipo_logradouro' => new sfWidgetFormInput(),
      'log_no_sem_acento'   => new sfWidgetFormInput(),
      'loc_nosub'           => new sfWidgetFormInput(),
      'ufe_no'              => new sfWidgetFormInput(),
      'ufe_sg'              => new sfWidgetFormInput(),
      'log_complemento'     => new sfWidgetFormInput(),
      'log_no'              => new sfWidgetFormInput(),
      'log_nome'            => new sfWidgetFormInput(),
      'bai_no_abrev'        => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorDoctrineChoice(array('model' => 'CEP_Brazil', 'column' => 'id', 'required' => false)),
      'bai_no'              => new sfValidatorString(array('max_length' => 70, 'required' => false)),
      'cep'                 => new sfValidatorString(array('max_length' => 8, 'required' => false)),
      'log_tipo_logradouro' => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'log_no_sem_acento'   => new sfValidatorString(array('max_length' => 70, 'required' => false)),
      'loc_nosub'           => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'ufe_no'              => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'ufe_sg'              => new sfValidatorString(array('max_length' => 2, 'required' => false)),
      'log_complemento'     => new sfValidatorString(array('max_length' => 120, 'required' => false)),
      'log_no'              => new sfValidatorString(array('max_length' => 70, 'required' => false)),
      'log_nome'            => new sfValidatorString(array('max_length' => 120, 'required' => false)),
      'bai_no_abrev'        => new sfValidatorString(array('max_length' => 40, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('cep_brazil[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'CEP_Brazil';
  }

}
